package Assignment;

import java.util.Random;

//需求：一个大V直播抽奖，奖品是现金红包，分别有{2,588,888,1000,10000}五个奖金。请使用代码模拟抽奖，打印出每个奖项，奖项的出现顺序要随机且不重复。打印效果如下：（随机顺序，不一定是下面的顺序）
public class Test11 {
    public static void main(String[] args) {
        int[] bonus = {2,588,1000,10000};
        Award(bonus);
        printArr(bonus);
    }
    public static void Award(int[] bons){
        Random random = new Random();

        for (int i = 0; i < bons.length; i++) {
            int index = random.nextInt(bons.length);
            int temp = bons[i];
            bons[i] = bons[index];
            bons[index] = temp;
        }
    }

    public static void printArr(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]+"元的奖金被抽出");
        }
    }
}
